# #Lagos download script
LAGOSNE::lagosne_get(dest_folder = LAGOSNE:::lagos_path())
## Warning in LAGOSNE::lagosne_get(dest_folder = LAGOSNE:::lagos_path()): LAGOSNE data for this version already exists on the local machine.
## Re-download if neccessary using the 'overwrite` argument.'
#Load in lagos
lagos <- lagosne_load()
## Warning in (function (version = NULL, fpath = NA) : LAGOSNE version unspecified,
## loading version: 1.087.3
#Grab the lake centroid info
lake_centers <- lagos$locus
#Look at the column names
#names(lake_centers)
#Look at the structure
#str(lake_centers)
#View the full dataset
#View(lake_centers %>% slice(1:100))
spatial_lakes <- st_as_sf(lake_centers,coords=c('nhd_long','nhd_lat'),
crs=4326) %>%
st_transform(2163)
#Subset for plotting
subset_spatial <- spatial_lakes %>%
slice(1:100)
subset_baser <- spatial_lakes[1:100,]
#Dynamic mapviewer
mapview(subset_spatial)
states <- us_states()
#Plot all the states to check if they loaded
#mapview(states)
minnesota <- states %>%
filter(name == 'Minnesota') %>%
st_transform(2163)
#Subset lakes based on spatial position
minnesota_lakes <- spatial_lakes[minnesota,]
minnesota_lakes$state <- "Minnesota"
#Plotting the first 1000 lakes
minnesota_lakes %>%
arrange(-lake_area_ha) %>%
slice(1:1000) %>%
mapview(.,zcol = 'lake_area_ha')
ia_il <- states[which(states$state_name=='Iowa' | states$state_name=="Illinois"),]
mapview(ia_il)
iowa <- states %>%
filter(name == 'Iowa') %>%
st_transform(2163)
iowa_lakes <- spatial_lakes[iowa,]
iowa_lakes$state <- "Iowa"
illinois <- states %>%
filter(name == 'Illinois') %>%
st_transform(2163)
illinois_lakes <- spatial_lakes[illinois,]
illinois_lakes$state <- "Illinois"
ia_il_lakes <- rbind(iowa_lakes, illinois_lakes)
There are 11,822 lakes in Illinois and 4,644 lakes in Iowa, totaling 16,466 lakes between the two states. This is slightly more than half of the number of lakes within Minnesota (56.7% -> 16,466 / 29,038).
ia_mn_lakes <- rbind(iowa_lakes, minnesota_lakes)
ggplot(data=ia_mn_lakes, aes(log(lake_area_ha), color=state)) +
xlab(" Lake Area (Log Hectare)") +
ylab("Frequency") +
ggtitle("Frequency of Lakes in IA and MN by Log Areas") +
geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
ggplot(data=ia_mn_lakes, aes(log(lake_area_ha))) +
xlab(" Lake Area (Log Hectare)") +
ylab("Frequency") +
ggtitle("Frequency of Lakes in IA and MN by Log Areas") +
facet_wrap(~state) +
geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
#This will only show the first 5,000 lakes, or roughly the first 1/3 of total lakes.
ia_il_lakes %>%
arrange(-lake_area_ha) %>%
slice(1:5000) %>%
mapview(.,zcol = 'lake_area_ha')
I would recommend including state departmental GIS data that manages reservoirs and artificial wetland systems. In Colorado, that would be the Department of Water Resources. This data is also available at many county-levels, but just analyzing at the state-level would probably require some data rectification and massaging for them to be output in the same format. This problem would drastically increase at the county level.
Besides the state-level, USGS would also maintain this data similar to their stream gage monitoring system.